package com.lwj.liwanjia.adapter;

import android.content.Context;
import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.lwj.liwanjia.R;
import com.lwj.liwanjia.bean.NewProductMoreBean;
import com.superrecycleview.superlibrary.adapter.BaseViewHolder;
import com.superrecycleview.superlibrary.adapter.SuperBaseAdapter;

import java.util.List;

/**
 * Created by Administrator on 2017/9/11.
 */

public class ProductMoreAdapter extends SuperBaseAdapter<NewProductMoreBean.DataBean.CommendityBean> {
    private Context mContext;

    public ProductMoreAdapter(Context context, List<NewProductMoreBean.DataBean.CommendityBean> data) {
        super(context, data);
        mContext = context;
    }

    @Override
    protected void convert(BaseViewHolder holder, NewProductMoreBean.DataBean.CommendityBean item, int position) {
        Glide.with(mContext).load(item.getImageUrl()).placeholder(R.mipmap.station).error(R.mipmap.station).into((ImageView) holder.getView(R.id.product_image));
        holder.setText(R.id.product_name, item.getCommodityName())
                .setText(R.id.product_jianjie, item.getCommdityInfo())
                .setText(R.id.product_price, "￥" + item.getNowPrice())
                .setText(R.id.product_time, item.getUpSellTime() + "上架");
    }

    @Override
    protected int getItemViewLayoutId(int position, NewProductMoreBean.DataBean.CommendityBean item) {
        return R.layout.product_more_item;
    }
}
